import parseHTML from './parseAst.js'
import generate from './generate.js';

function compileToFunction(domStr) { // 接受一个dom的outerHTML
  const ast = parseHTML(domStr);
  const code = generate(ast);
  let render = new Function(`with(this){ return ${code} }`);
  return render;
}

export default compileToFunction;